/**
 * routes_config.js
 * PLM项目路由配置文件
 */

module.exports = {
  // 系统级路由
  SYSTEM: {
    HOME: '/pages/index/index',
    LOGIN: '/pages/login/login',
    ERROR: '/pages/error/error'
  },
  
  // 项目相关路由
  PROJECT: {
    INDEX: '/pages/project/index',
    LIST: '/pages/project/list',
    DETAIL: '/pages/project/detail',
    EDIT: '/pages/project/edit',
    CREATE: '/pages/project/create'
  },
  
  // 研发过程路由
  RESEARCH: {
    INDEX: '/pages/research/index',
    LIST: '/pages/research/list',
    DETAIL: '/pages/research/detail',
    PHASE: '/pages/research/phase',
    DOCUMENT: '/pages/research/document'
  },
  
  // 文件管理路由
  FILE: {
    LIST: '/pages/file/list',
    UPLOAD: '/pages/file/upload',
    DETAIL: '/pages/file/detail'
  },
  
  // 个人中心路由
  USER: {
    INDEX: '/pages/user/index',
    PROFILE: '/pages/user/profile',
    SETTINGS: '/pages/user/settings'
  },
  
  // 管理员路由
  ADMIN: {
    INDEX: '/pages/admin/index',
    USER: '/pages/admin/user',
    PROJECT: '/pages/admin/project',
    SETTINGS: '/pages/admin/settings'
  },
  
  /**
   * 获取绝对路径
   * @param {string} path - 路由路径
   * @returns {string} 添加了项目前缀的完整路径
   */
  getFullPath: function(path) {
    if (!path) return '';
    
    // 如果已经是绝对路径则直接返回
    if (path.startsWith('/')) {
      return path;
    }
    
    // 添加PLM项目前缀
    return '/projects/plm' + (path.startsWith('/') ? path : '/' + path);
  }
}; 